// import { getRequestUrl, postRequestUrl } from '@/api/manage.js'

import {getList} from "@/api/manualNegativeInvoice";

const flowInvoice = {
    namespaced: true,
    state: {
        flowList: [],
        pages: {
            current: 1,
            size: 10,
            total: 0
        }
    },
    mutations: {

        ChangeNegativeList(state, val) {
            state.flowList = val.records;
            state.pages = {
                current: val.current,
                size: val.size,
                total: val.total
            }
        },

        reset(state) {
            state.flowForm = {
                ywzt: '',
                xzjc: '',
                zjlx: '',
                khxm: '',

                hprmc: '',
                tbdh: '',
                jyrq: '',
                bdhbqhdqjsh: '',

                xpxslh: '',
                lyxt: '',
                sfgryw: '',
            }
            state.pages = {
                current: 1,
                size: 10,
                total: 0
            }
        },
    },
    actions: {
        async getList({commit, state}, payload) {
            let params = {
                ...state.pages,
                pageNo: state.pages.current,
                pageSize: state.pages.size,
            }
            const {data, code, message} = await getList(params);
            // let { data,code ,message } = await ElTree({
            //     ...state.flowForm,
            //     ...state.pages,
            // })

            if (code == 200) {
                commit('ChangeNegativeList', data)
            }
        },
    },
}

export default flowInvoice
